﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TravelLink.WebApp.Admin {
    public partial class AdminUserResume : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            this.CheckResponse("1002");
        }

        protected void abtnSearch_Click(object sender, EventArgs e) {
            this.LinqDataSource1.Where = "1==1";
            if (this.adefrom.Date != DateTime.MinValue) {
                this.LinqDataSource1.Where += @"&&Birthday>=@datefrom";
                this.LinqDataSource1.WhereParameters.Add("datefrom", System.Data.DbType.DateTime, this.adefrom.Date.ToString("yyyy-MM-dd 00:00:00"));
            }
            if (this.adeto.Date != DateTime.MinValue) {
                this.LinqDataSource1.Where += @"&&Birthday<=@dateto";
                this.LinqDataSource1.WhereParameters.Add("dateto", System.Data.DbType.DateTime, this.adeto.Date.ToString("yyyy-MM-dd 23:59:59"));
            }
            if (this.atbmail.Text.Trim() != string.Empty) {
                this.LinqDataSource1.Where += "&&Email==@Mail";
                this.LinqDataSource1.WhereParameters.Add("Mail", this.atbmail.Text);
            }
            if (this.atbmobile.Text.Trim() != string.Empty) {
                this.LinqDataSource1.Where += "&&Mobile==@Mobile";
                this.LinqDataSource1.WhereParameters.Add("Mobile", this.atbmobile.Text);
            }
        }

        protected void ASPxButton1_Click(object sender, EventArgs e) {
            ASPxGridViewExporter1.WriteXlsToResponse(true);
        }
    }
}